<template>
  <div class="comprehensive-bot">
    <div class="comprehensive-table">
      <div class="con-box">
        <div class="tit">订单统计</div>
        <ul class="con-table">
          <li>
            <div class="th">销售总额</div>
            <div class="td">￥<span>{{ orderData.totalMoney }}</span></div>
          </li>
          <li>
            <div class="th">有效订单总数</div>
            <div class="td">{{ orderData.effectiveOrder }}</div>
          </li>
          <li>
            <div class="th">有效订单总额</div>
            <div class="td">￥<span>{{ orderData.effectiveMoney }}</span></div>
          </li>
          <li>
            <div class="th">无效订单总数（关闭或取消）</div>
            <div class="td">{{ orderData.invalidOrder }}</div>
          </li>
          <li>
            <div class="th">无效订单总额</div>
            <div class="td">￥<span>{{ orderData.invalidMoney }}</span></div>
          </li>
          <li>
            <div class="th">已成交订单总数</div>
            <div class="td">{{ orderData.finishMoney }}</div>
          </li>
          <li>
            <div class="th">已成交订单总额</div>
            <div class="td">￥<span>{{ orderData.finishOrder }}</span></div>
          </li>
        </ul>
      </div>
      <div class="con-box">
        <div class="tit">用户统计</div>
        <ul class="con-table">
          <li>
            <div class="th">用户总数</div>
            <div class="td">{{ userData.userStatistics }}</div>
          </li>
          <li>
            <div class="th">有订单用户数 </div>
            <div class="td">{{ userData.getCode }}</div>
          </li>
          <li>
            <div class="th">用户订单总数</div>
            <div class="td">{{ userData.getAll }}</div>
          </li>
          <li>
            <div class="th">用户购买金币总数</div>
            <div class="td">{{ userData.getMoney }}</div>
          </li>
          <li>
            <div class="th">用户购买率</div>
            <div class="td">{{ userData.userPurchase }}</div>
          </li>
          <li>
            <div class="th">用户订单均数</div>
            <div class="td">{{ userData.userOrderMean }}</div>
          </li>
          <li>
            <div class="th">用户购买均额</div>
            <div class="td">￥<span>{{ userData.userPurchaseSum }}</span></div>
          </li>
        </ul>
      </div>
      <div class="con-box">
        <div class="tit">总赠送聚合金币值/金币统计</div>
        <ul class="con-table">
          <li>
            <div class="th">总赠送金币</div>
            <div class="td">{{ goldData.g }}</div>
          </li>
          <li>
            <div class="th">总赠送聚合金币 </div>
            <div class="td">{{ goldData.j }}</div>
          </li>
          <!-- <li>
            <div class="th">操作</div>
            <div class="td"><span
class="seeBtn"
                                  @click="seeBtn"
>查看订单</span></div>
          </li> -->
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import { getStatisData, getOrderData, getGoldData } from '@/api/capital.js'
export default {
  data() {
    return {
      userData: [],
      orderData: [],
      goldData: {
        g: null,
        j: null
      }
    }
  },
  created() {
    this.getUserData()
  },
  methods: {
    // 用户统计
    getUserData(startTime, endTime) {
      getOrderData({
        startTime,
        endTime
      }).then(res => {
        this.orderData = res.data[0]
      })
      getStatisData({
        startTime,
        endTime
      }).then(res => {
        console.log(res)
        this.userData = res.data
      })
      getGoldData({ startTime,
        endTime }).then(res => {
        console.log(res)
        res.data.map(item => {
          if (item.coinType === 'g') {
            this.goldData.g = item.count
          }
          if (item.coinType === 'j') {
            this.goldData.j = item.count
          }
        })
      })
    },
    // 查看
    seeBtn() {

    }
  }
}
</script>
